package jp.mslab.android.firstone;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup.LayoutParams;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Button;
import android.widget.LinearLayout;

public class Webview_testActivity extends Activity {
	private WebView		m_webview;
	private static final String		c_hostUrl = "http://10.0.2.2";
	
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        //setContentView(R.layout.main);
        
        LinearLayout ll = new LinearLayout(this);
        ll.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
        ll.setOrientation(LinearLayout.VERTICAL);
        setContentView(ll);
        
        m_webview = new WebView(this);  
        m_webview.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
        m_webview.setWebViewClient(new WebViewClient());
        
        Button btn = new Button(this);
        btn.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View arg0) {
				// TODO Auto-generated method stub
				m_webview.loadUrl(c_hostUrl);
			}
        });
        btn.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
        btn.setText("go my host(" + c_hostUrl + ")");
        ll.addView(btn);
        
        ll.addView(m_webview);
    }
    
    @Override
    public void onStart() {
    	super.onStart();
    }
}